package felix.engine.js.msg;

import lombok.Data;

import java.io.Serializable;

@Data
public final class JsMsg implements Serializable {

    private final String id;
    private final String type;
    private final JsMsgMetaData metaData;
    private final JsMsgDataType dataType;
    private final Object data;

    public JsMsg(String id, String type, JsMsgMetaData metaData, JsMsgDataType dataType, Object data) {
        this.id = id;
        this.type = type;
        this.metaData = metaData;
        this.dataType = dataType;
        this.data = data;
    }

    public JsMsg(String id, String type, JsMsgMetaData metaData, Object data) {
        this.id = id;
        this.type = type;
        this.metaData = metaData;
        this.dataType = JsMsgDataType.JSON;
        this.data = data;
    }

}
